package interceptcrossing;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;

public class InterceptFileWriter {

	private PrintWriter printWriter;

	public InterceptFileWriter(File file) throws IOException {
		this.printWriter = new PrintWriter(file);
	}

	public void write(Intercept intercept) throws IOException {
		this.printWriter.println(String.format("%f\t%f\t%f\t%f",
			intercept.begin().x(), intercept.begin().y(),
			intercept.end().x(), intercept.end().y()));
	}

	public void close() {
		if (this.printWriter != null) {
			this.printWriter.close();
		}
	}
}
